package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 结算记录
 * </p>
 *
 * @author linan
 * @date 2023-05-26
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ExhibitionSettlementCompanyTypeEnum", description = "企业类型 #{HOME_SERVICE_PROVIDER:主场服务商;MAIN_TRANSPORT_SERVICE_PROVIDER:主运服务商;MATCHING_SERVICE_PROVIDER:配套服务商-枚举")
public enum ExhibitionSettlementCompanyTypeEnum implements BaseEnum {

    /**
     * HOME_SERVICE_PROVIDER="主场服务商"
     */
    HOME_SERVICE_PROVIDER("主场服务商"),
    /**
     * MAIN_TRANSPORT_SERVICE_PROVIDER="主运服务商"
     */
    MAIN_TRANSPORT_SERVICE_PROVIDER("主运服务商"),
    /**
     * MATCHING_SERVICE_PROVIDER="配套服务商"
     */
    MATCHING_SERVICE_PROVIDER("配套服务商"),

    /**
     * BUILD_SERVICE_PROVIDER="搭建商"
     */
    BUILD_SERVICE_PROVIDER("搭建商"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ExhibitionSettlementCompanyTypeEnum match(String val, ExhibitionSettlementCompanyTypeEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ExhibitionSettlementCompanyTypeEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ExhibitionSettlementCompanyTypeEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "HOME_SERVICE_PROVIDER,MAIN_TRANSPORT_SERVICE_PROVIDER,MATCHING_SERVICE_PROVIDER", example = "HOME_SERVICE_PROVIDER")
    public String getCode() {
        return this.name();
    }

}
